package org.jason.model.interaction.es;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Document(indexName = "article_comment")
@ApiModel(value = "ArticleComment对象", description = "文章评论索引")
public class ArticleComment implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键")
    @Id
    private String id;

    @ApiModelProperty(value = "用户id")
    @Field(type = FieldType.Keyword)
    private Integer userId;

    @ApiModelProperty(value = "用户昵称")
    @Field(type = FieldType.Keyword)
    private String nickname;

    @ApiModelProperty(value = "文章id")
    @Field(type = FieldType.Keyword)
    private Integer articleId;

    @ApiModelProperty(value = "评论")
    @Field(type = FieldType.Text, analyzer = "ik_smart")
    private String comment;

    @ApiModelProperty(value = "点赞数")
    @Field(type = FieldType.Integer)
    private Integer likes;

    @ApiModelProperty(value = "评论时间")
    @Field(type = FieldType.Date,format = DateFormat.basic_date_time)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime commentTime;
}
